import { Injectable } from '@angular/core';
import { HOSTURL, PREFIX } from '../../config';
import { RequestClientService } from '../request-client.service';

@Injectable({
  providedIn: 'root'
})
export class ProjectService {

  constructor(
    private requestClientService: RequestClientService
  ) { }

  // 获取项目列表
  public async getProjects(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/QueryProjectPagedList`, params);
    return res;
  }
  // 添加项目信息
  public async addProjects(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/CreateOrModifyProject`, params);
    return res;
  }
  // 修改项目信息
  public async editProjects(params) {
    const res = await this.requestClientService.post(HOSTURL + `/api/services/${PREFIX}/Projects/CreateOrModifyProject`, params);
    return res;
  }
  // 删除项目信息
  public async deleteProjects(params) {
    const res = await this.requestClientService.delete(HOSTURL + `/api/services/${PREFIX}/Projects/RemoveProject`, params);
    return res;
  }
  // 根据项目code查询智慧工地项目id
  public async QueryProjectPagedList(params) {
    const res = await this.requestClientService.post(HOSTURL + '/api/services/huahui/QianBian/QueryProjectPagedList', params);
    return res;
  }

}
